package com.xiaoshangkou.hellopra.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaoshangkou.hellopra.mapper.Permission2Mapper;
import com.xiaoshangkou.hellopra.mapper.PermissionMapper;
import com.xiaoshangkou.hellopra.pojo.Permission;
import com.xiaoshangkou.hellopra.pojo.Permission2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * 关于数据库中的用户权限服务层
 *
 */
@Service
public class Permission2Service {
    @Autowired
    private Permission2Mapper permission2Mapper;

    //分页查询权限
    public Page<Permission2> findPermission2(int page, int size){
        Page<Permission2> permission2 = permission2Mapper.selectPage(new Page<>(page, size), null);
        return permission2;
    }
    //新建权限
    public void add(Permission2 permission2){
        permission2Mapper.insert(permission2);
    }

    //根据peid2删除权限
    public void delete(Integer peid2){
        permission2Mapper.deleteById(peid2);
    }

    //根据peid2查询权限内容
    public Permission2 findById(Integer peid2){
        Permission2 permission2 = permission2Mapper.selectById(peid2);
        return permission2;
    }

    //修改权限
    public void update(Permission2 permission2){
        permission2Mapper.updateById(permission2);
    }
}
